package org.dftproject.genesis.ui.figures;

import org.dftproject.genesis.ui.GenesisResources;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.jface.resource.JFaceResources;

public class CaptionPanel extends Figure {
	
	private final Label captionLabel;

	public CaptionPanel(String text, IFigure child) {
		ToolbarLayout layout = new ToolbarLayout(false);
		layout.setSpacing(10);
		setLayoutManager(layout);

		captionLabel = new Label(text);
		captionLabel.setLabelAlignment(PositionConstants.RIGHT);
		captionLabel.setFont(JFaceResources.getFont(GenesisResources.H1_FONT));
		add(captionLabel);

		add(child);
	}
	
	public void setText(String text) {
		captionLabel.setText(text);
	}

}
